<script>
// import treeMenuItem from '@/components/tree-menu-item.vue'
const createNode = (h, data) => {
  const nodes = []
  data.forEach((item) => {
    console.log(item)
    nodes.push(
      h('a-tree-node',
        {
          props: {
            isLeaf: item.isLeaf,
            title: item.title,
            key: item.id
          }
        },
        [
          ...createNode(h, item.children)
        ]
      )
    )
  })
  return nodes
}
export default {
  components: {
    // treeMenuItem
  },
  name: 'treeMenu',
  created () {
    console.log(this.data)
  },
  props: {
    data: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    onRightClick ({ event, node }) {
      this.emit({ event, node })
    }
  },
  render (h) {
    console.log(h)
    return h(
      'a-directory-tree',
      [
        ...createNode(h, this.data)
      ]
    )
  }
}
</script>
